import complex_query from '@feidao/web/atom/nodejs/db/complex-query';

import { spaceid, systemid } from './atom/config';

interface Message {
	page_size: number;
	page_no: number;
	asc: string;
	desc: string;
}

/**
 * @description 基本的查询
 * @param { page_size: 20,page_no: 1,asc: 'factory_name',desc: ''}
 */

export default async function atom(msg: Message, action_id: string, session_id: string) {
	const cquery = complex_query(action_id, spaceid, systemid);

	const res = await cquery.add_field('factory', 'factory_name', 'factory_name')
		.add_field('factory', 'postcode', 'postcode')
		.add_field('factory', 'factory_no', 'factory_no')
		.exec();
	return res;
}
